package com.codedancer.campus.client.api.school;

import com.codedancer.campus.client.service.ISchoolService;
import com.codedancer.campus.client.service.vo.school.SchoolVo;
import com.codedancer.campus.common.anno.PassToken;
import com.codedancer.campus.common.core.BaseApi;
import com.codedancer.campus.common.response.ApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/school")
@CrossOrigin(methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.DELETE,
    RequestMethod.PUT}, maxAge = 3600)
@Api(value = "学校Api", description = "学校Api", tags = "学校Api")
public class SchoolApi extends BaseApi {

    @Autowired
    private ISchoolService schoolService;

    @GetMapping("/all")
    @ApiOperation("获取全部学校(未删除和已启用)")
    @PassToken
    public ApiResponse<List<SchoolVo>> all() {
        return success(schoolService.all());
    }
}
